<?php

defined('BASEPATH') OR exit('No direct script access allowed');

class Reservation extends MY_Controller 
{
	public function __construct()
	{
		parent::__construct();
		$this->load->helper('utils');
		$this->load->model('reservation_model');
	}
	
	public function index()
	{
		$this->displayComboWithCalendar();
	}
	
	private function minAndMaxDate(& $minDate, & $maxDate)
	{
		$minDate = currentDate();
		$maxDate = addMonthToDate($minDate, 1);
		$maxDate = lastDayInMonth($maxDate);
	}
	
	private function displayComboWithCalendar()
	{
		$this->minAndMaxDate($data['minDate'], $data['maxDate']);

		$this->showView('datumrezervacie', $data);	
	}
	
	public function getTableData($datum)
	{
		// treba s user managementu ziskat usera
		if (! $this->reservation_model->getReservationArray(1, $datum, $courtReservationArray, $fromTime, $toTime))
			echo "";
		
		$data['courtReservationArray'] = $courtReservationArray;
		$data['customerId'] = -1;
		$data['fromTime'] = $fromTime;
		$data['toTime'] = $toTime;
		$tabulkaData = $this->loadView("tabulkarezervacii", $data);	
		echo $tabulkaData;
	}
}
?>
